#include <iostream>
#include <vector>

using namespace std;
// 344 翻转字符串
//给定一个字符串，返回这个字符串的倒序字符串。必须原地修改输入数组。空间复杂度为O(1)
// 输入字符串以字符数组 s 的形式给出。
//- 如“hello”，返回“olleh”
// 输入：s = ["h","e","l","l","o"]
// 输出：["o","l","l","e","h"]
//- 类似：翻转一个数组
// https://leetcode.cn/problems/reverse-string/description/

class Solution {
public:
    void reverseString(vector<char>& s) {
        int i = 0, j = s.size() - 1;
        while(i < j) {
            swap(s[i], s[j]);
            i++;
            j--;
        }
    }
};

int main() {
    vector<char> s1 = {'h','e','l','l','o'};
    Solution().reverseString(s1);
    return 0;
}
